diff --git a/keyserver/src/frog/frog.js b/keyserver/src/frog/frog.js index 9adacfcf0..83a1cc80d 100644 --- a/keyserver/src/frog/frog.js +++ b/keyserver/src/frog/frog.js @@ -1,83 +1,152 @@ // @flow - /** @jsxImportSource hono/jsx */ /* eslint-disable react/react-in-jsx-scope */ import { serve } from '@hono/node-server'; import { Button, Frog } from 'frog'; import { inviteLinkURL } from 'lib/facts/links.js'; import { ignorePromiseRejections } from 'lib/utils/promises.js'; import { neynarClient } from '../utils/fc-cache.js'; import { redisCache } from '../utils/redis-cache.js'; function startFrogHonoServer() { const frogApp = new Frog({ title: 'Comm' }); - frogApp.frame('/:inviteLink/:channelID', async c => { - const { inviteLink, channelID } = c.req.param(); + frogApp.frame('/:inviteLink/:channelID/:taggerUsername', async c => { + const { inviteLink, channelID, taggerUsername } = c.req.param(); let buttonLink = 'https://comm.app'; const inviteLinkURLPrefix = inviteLinkURL(''); if (inviteLink.startsWith(inviteLinkURLPrefix)) { buttonLink = inviteLink; } let channelInfo = await redisCache.getChannelInfo(channelID); if (!channelInfo) { channelInfo = await neynarClient?.fetchFarcasterChannelByID(channelID); if (channelInfo) { ignorePromiseRejections( redisCache.setChannelInfo(channelID, channelInfo), ); } } let header_image_url = 'https://warpcast.com/~/images/DefaultChannelCoverImage.png'; if (channelInfo?.header_image_url) { header_image_url = channelInfo.header_image_url; } + const displayUsername = + taggerUsername.length > 16 + ? `${taggerUsername.slice(0, 16)}[...]` + : taggerUsername; + + const channelIcon = channelInfo?.image_url ? ( + icon + ) : null; + return c.res({ image: (
frame background +
+
+ {channelIcon} + + Thread Invitation + +
+ +
+ + @{displayUsername} created a thread on Comm + +
+
), intents: [ Join chat , ], }); }); serve({ fetch: frogApp.fetch, port: parseInt(process.env.FROG_PORT, 10) || 3001, }); } export { startFrogHonoServer };